import { ref, onMounted, onUnmounted } from 'vue';
export function ex(width: number, height: number) {
  const x = ref(0);
  const y = ref(0);

  function update(e: MouseEvent) {
    x.value = e.pageX - width;
    y.value = e.pageY - height;
  }

  onMounted(() => {
    window.addEventListener('mousemove', update);
  });

  onUnmounted(() => {
    window.removeEventListener('mousemove', update);
  });

  return { x, y };
}
